package IC.Semantics.types;

public class NullType extends SemanticType
{

	public NullType() {
		super(SemanticType.NULL_TYPE_NAME);
	}

	@Override
	public boolean subtypeOf(SemanticType t) {
		return isReferenceType(t);
	}
	
		
	/**
	 * this method checks if a type is a reference type according to the IC language specifications.  
	 * it is used only to check null sub-typing against other types so it is found under the null type class.
	 * it is static because it has no dependence on any specific null occurrence.
	 * 
	 * @param t the type we check
	 * @return true iff t is a reference type (in IC) 
	 */
	private static boolean isReferenceType(SemanticType t)
	{
		if (t.name.equals(SemanticType.INT_TYPE_NAME) || t.name.equals(SemanticType.BOOLEAN_TYPE_NAME) || t.name.equals(SemanticType.VOID_TYPE_NAME))
			return false;
		
		return true;
	}

}
